//
//  QTTLaunchViewController.m
//  QuTouTiao
//
//  Created by 杨杨子 on 2018/6/17.
//  Copyright © 2018年 杨杨子. All rights reserved.
//

#import "QTTLaunchViewController.h"
#import "QTTRegisterViewController.h"

@interface QTTLaunchViewController ()
@property (weak, nonatomic) IBOutlet UILabel *timeLB;
- (IBAction)jumpAction:(id)sender;
@property (nonatomic,assign) NSInteger timerCount;
@property (weak, nonatomic) IBOutlet UIImageView *adsImageView;


@end

@implementation QTTLaunchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.adsImageView.alpha = 0;
    self.timerCount = 5;
    self.timeLB.layer.cornerRadius = self.timeLB.height/2.0;
    self.timeLB.layer.masksToBounds = YES;
    self.timeLB.layer.borderColor = [UIColor blackColor].CGColor;
    self.timeLB.layer.borderWidth = 1.0;
//    NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
    
    [timer fire];
    //
    
}
-(void)timerAction{
    
    self.timeLB.text = [NSString stringWithFormat:@"%ldS",self.timerCount];
    if (self.timerCount == 1) {
        QTTRegisterViewController * registerVc = [[QTTRegisterViewController alloc] init];
        [self presentViewController:registerVc animated:YES completion:nil];
    }
    self.timerCount -- ;
    
}
- (IBAction)jumpAction:(id)sender {
    QTTRegisterViewController * registerVc = [[QTTRegisterViewController alloc] init];
    [self presentViewController:registerVc animated:YES completion:nil];
}
@end
